import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
   title: '轮播图',
   align:"center",
   dataIndex: 'filePath',
     customRender:render.renderImage,
  },
   {
    title: '排序序号',
    align:"center",
    dataIndex: 'sort'
   },
  {
   title: '发布状态',
   align:"center",
   dataIndex: 'publishStatus_dictText'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "排序序号",
      field: 'sort',
      component: 'InputNumber',
      //colProps: {span: 6},
 	},
	{
	    label: "发布状态",
	    field: 'publishStatus',
	    component: 'JDictSelectTag',
	    componentProps:{
	        dictCode:"web_publish_status"
	    },
	    //colProps: {span: 6},
	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '封面图',
   field: 'filePath',
   component: 'JImageUpload',
   componentProps:{
      fileMax: 1
    },
  },
  {
    label: '排序序号',
    field: 'sort',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入排序序号!'},
          ];
     },
  },
  {
    label: '发布状态',
    field: 'publishStatus',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"web_publish_status"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请选择发布状态!'},
          ];
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  sort: {title: '排序序号',order: 0,view: 'number', type: 'number',},
  publishStatus: {title: '发布状态',order: 1,view: 'list', type: 'string',dictCode: 'web_publish_status',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
